<link href="static/js/swfupload/swfupload.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="static/js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="static/js/swfupload/swfupload.swfobject.js"></script>
<script type="text/javascript" src="static/js/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="static/js/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="static/js/swfupload/handlers.js"></script>
<!--图片上传-->
<style type="text/css">
	.swfupload {
		position: absolute;
		z-index: 888;
		width: 70px;
		height:27px;
	}
	.t_input				{ padding: 6px; }
	.updone					{ margin-top: -10px; }
	.updone li				{ float: left; margin-right:17px; margin-top:17px; position: relative; }
	.updone li.dlist a		{ display: block; position: absolute; width:12px; height:12px; background:#000088; }
	.updone .dlist .setThumb{ top:-5px; left:-5px; background:url(static/images/icons.png) -24px 0px no-repeat; }
	.updone .dlist .deluppic{ top:-5px; left:12px; background:url(static/images/icons.png) -12px 0px no-repeat; }
	.updone .dlist .setThumbOK	{ background:url(static/images/icons_1.png) -24px 0px no-repeat; }
	.updone .dlist .imgSelect{ border:2px solid #c20000; }
	.updone li img			{ float: left; cursor: pointer; }
	.updone .delall			{ height:26px; line-height:26px; margin:20px 0px 0px 0px; }
	.updone .delall a		{ display: block; float:left; text-decoration:none; color:#c20000; height:26px; padding:0 15px; border:1px solid #bbb; }
</style>
<script type="text/javascript">
	//swf upload
	var swfu;
	
	SWFUpload.onload = function () {
		var settings = {
			flash_url : "./static/js/swfupload/swfupload.swf",
			upload_url: "/<!--{U str='admin/album/upload'}-->",
			post_params: {"PHPSESSID" :"NONE"},
			use_query_string : false, //支持传输自定义参数
			file_size_limit : "100 MB",
			file_types : "*.jpg;*.jpeg;*.gif;*.png",
			file_types_description: "图片文件",
			file_upload_limit : 100,
			file_queue_limit : 0,
			custom_settings : {
				progressTarget : "fsUploadProgress",
				cancelButtonId : "btnCancel"
			},
			debug: false,
	
			// Button Settings
			button_placeholder_id : "spanButtonPlaceholder",
			button_width: 80,
			button_height: 30,
			button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
			button_cursor: SWFUpload.CURSOR.HAND,
	
			// The event handler functions are defined in handlers.js
			swfupload_loaded_handler : swfUploadLoaded,
			file_queued_handler : fileQueued,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			queue_complete_handler : queueComplete,	// Queue plugin event
			
			// SWFObject settings
			minimum_flash_version : "9.0.28",
			swfupload_pre_load_handler : swfUploadPreLoad,
			swfupload_load_failed_handler : swfUploadLoadFailed
		};
	
		swfu = new SWFUpload(settings);
		
		//alert(settings.upload_url);
	}
	
	// 删除单张已上传图片
	function deluppic(key){
		if(confirm('确定删除?')){
			$.ajax({
				url: '<!--{U str="admin/album/delpic"}-->',
				type : 'GET',
				data : {id:key},
				cache: false,
				success: function(res){
					//picslist();
					if(res.result){
						$('#pic_'+key).hide();
						//alert(key);
						picslist();
					}
				},
				dataType :'json',
			});
		}
	}
	
	// 加载已上传图片
	function picslist(){
		$.ajax({
			url: '<!--{U str="admin/album/itemlist"}-->',
			cache: false,
			success: function(res){
				$('.pics_list').show();
				$('#pics_upload_list').html(res);
			}
		});
	}
</script>